<style lang="less">
  .page_style {
    margin-top: 10px;
    text-align: right;
  }
  .item1{
    height: 42px;
    line-height: 40px;
  }
</style>
 <template>
    <div>
      <Table border :columns="columns1" :data="datas1" ref="table5"></Table>
      <Page :total="totalnum" class="page_style" :current="currentpageNo"
            :page-size="currentpageSize" @on-change="change1"/>

      <Modal v-model="showNotice" title="通知详情" width="700">
        <Form :model="paramData">
          <Row class="item1">
            <Col span="6" style="text-align: right" class="red-name">标题:</Col>
            <Col span="12" offset="1">{{paramData.title}}</Col>
          </Row>
          <Row class="item1">
            <Col span="6" style="text-align: right" class="">订单编号:</Col>
            <Col span="12" offset="1">{{paramData.order_code}}</Col>
          </Row>
          <Row class="item1" style="height:auto">
            <Col span="6" style="text-align: right" class="">内容:</Col>
            <Col span="12" offset="1">{{paramData.content}}</Col>
          </Row>
        </Form>
        <div slot="footer">
          <Button type="error" @click="showNotice=false">关闭</Button>
        </div>
      </Modal>
    </div>
 </template>
<script>
import { findDailyRecordList, buIdInfo } from '@/api/dailyrecord'

export default {
  data () {
    return {
      datas1: [],
      showNotice: false,
      paramData: { 'content': '' },
      currentpageNo: 1,
      currentpageSize: 1,
      totalnum: 0,
      columns1: [
        { title: '序号', type: 'index', width: 100, align: 'center' },
        { title: '名称', key: 'title', align: 'center' },
        { title: '订单编号', key: 'order_code', align: 'center' },
        { title: '创建时间', key: 'create_time', align: 'center' },
        { title: '操作',
          key: 'action',
          align: 'center',
          render: (h, params) => {
            let temp = []
            temp.push(
              h('Button', {
                props: { type: 'info', size: 'small' },
                style: {},
                on: {
                  click: () => {
                    this.byidinfo(params)
                  }
                }
              }, '查看詳情')
            )
            return h('div', temp)
          }

        }

      ]
    }
  },
  methods: {
    byidinfo (param) {
      console.log(param)
      let id = param.row.id
      let data2 = { 'id': id }
      buIdInfo(data2).then(res => {
        if (res.data.errcode === 0) {
          this.showNotice = true
          console.log('222222222')
          this.paramData = res.data.data
          // this.paramData.content = JSON.stringify(res.data.data.content).Replace('"', ''
          let headertemp = JSON.parse(this.paramData.content)
          this.paramData.content = JSON.stringify(headertemp, null, 2)
          console.log(this.paramData)
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '获取日志详情失败' })
        }
      })
    },
    change1 (pageNo) {
      this.currentpageNo = pageNo
      this.show()
    },
    show () {
      let data1 = {
        'pageNo': this.currentpageNo,
        'pageSize': this.currentpageSize
      }
      findDailyRecordList(data1).then(res => {
        if (res.data.errcode === 0) {
          console.log(res)
          this.datas1 = res.data.data.results
          this.totalnum = res.data.data.totalRecord
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '获取日志列表失败' })
        }
      })
    }
  },
  mounted () {
    this.show()
  }
}
</script>
